package com.sky.controller.user;

import com.sky.constant.StatusConstant;
import com.sky.entity.Setmeal;
import com.sky.mapper.SetmealMapper;
import com.sky.result.Result;
import com.sky.service.SetMealService;
import com.sky.service.SetmealDishService;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/user/setmeal")
@Slf4j
@Api(value ="用户端查看套餐")
public class UserSetMealController {
    @Autowired
    private SetMealService setmealService;

   /* @Autowired
    private SetmealDishService setmealDishService;*/


    @GetMapping("/list")
    @ApiOperation(value = "用户获取套餐")
    public Result getSetmeal(Long categoryId) {
     List<SetmealVO>  setmeal= setmealService.findByCategoryId(categoryId);
        return Result.success(setmeal);
    }
    @GetMapping("/dish/{id}")
    @ApiOperation(value = "用户获取套餐")
    public Result getSetmealById(@PathVariable("id") Long id) {
     List<DishItemVO> setmeal    = setmealService.findBySetmealId(id);
     return Result.success(setmeal);
    }
}
